home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / Peon / PeonSDK-Win32-1.0.0.exe / {app} / PeonMain / include / PeonPlatform.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-11-07  |  5.4 KB  |  193 lines

  1.  
  2. /*
  3. -----------------------------------------------------------------------------
  4. This source file is part of OGRE
  5.     (Object-oriented Graphics Rendering Engine)
  6. For the latest info, see http://www.ogre3d.org/
  7.  
  8. Copyright (c) 2000-2005 The OGRE Team
  9. Also see acknowledgements in Readme.html
  10.  
  11. This program is free software; you can redistribute it and/or modify it under
  12. the terms of the GNU Lesser General Public License as published by the Free Software
  13. Foundation; either version 2 of the License, or (at your option) any later
  14. version.
  15.  
  16. This program is distributed in the hope that it will be useful, but WITHOUT
  17. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  18. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
  19.  
  20. You should have received a copy of the GNU Lesser General Public License along with
  21. this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  22. Place - Suite 330, Boston, MA 02111-1307, USA, or go to
  23. http://www.gnu.org/copyleft/lesser.txt.
  24. -----------------------------------------------------------------------------
  25. */
  26.  
  27. #ifndef __PEONPLATFORM_H_
  28. #define __PEONPLATFORM_H_
  29.  
  30.  
  31. namespace peon {
  32.  
  33. /* Initial platform/compiler-related stuff to set.
  34. */
  35. #define PEON_PLATFORM_WIN32 1
  36. #define PEON_PLATFORM_LINUX 2
  37. #define PEON_PLATFORM_APPLE 3
  38.  
  39. #define PEON_COMPILER_MSVC 1
  40. #define PEON_COMPILER_GNUC 2
  41. #define PEON_COMPILER_BORL 3
  42.  
  43. #define PEON_ENDIAN_LITTLE 1
  44. #define PEON_ENDIAN_BIG 2
  45.  
  46. #define PEON_ARCHITECTURE_32 1
  47. #define PEON_ARCHITECTURE_64 2
  48.  
  49. /* Finds the compiler type and version.
  50. */
  51. #if defined( _MSC_VER )
  52. #   define PEON_COMPILER PEON_COMPILER_MSVC
  53. #   define PEON_COMP_VER _MSC_VER
  54.  
  55. #elif defined( __GNUC__ )
  56. #   define PEON_COMPILER PEON_COMPILER_GNUC
  57. #   define PEON_COMP_VER (((__GNUC__)*100) + \
  58.         (__GNUC_MINOR__*10) + \
  59.         __GNUC_PATCHLEVEL__)
  60.  
  61. #elif defined( __BORLANDC__ )
  62. #   define PEON_COMPILER PEON_COMPILER_BORL
  63. #   define PEON_COMP_VER __BCPLUSPLUS__
  64.  
  65. #else
  66. #   pragma error "No known compiler. Abort! Abort!"
  67.  
  68. #endif
  69.  
  70. /* See if we can use __forceinline or if we need to use __inline instead */
  71. #if PEON_COMPILER == PEON_COMPILER_MSVC 
  72. #   if PEON_COMP_VER >= 1200
  73. #       define FORCEINLINE __forceinline
  74. #   endif
  75. #else
  76. #   define FORCEINLINE __inline
  77. #endif
  78.  
  79. /* Finds the current platform */
  80.  
  81. #if defined( __WIN32__ ) || defined( _WIN32 )
  82. #   define PEON_PLATFORM PEON_PLATFORM_WIN32
  83.  
  84. #elif defined( __APPLE_CC__)
  85. #   define PEON_PLATFORM PEON_PLATFORM_APPLE
  86.  
  87. #else
  88. #   define PEON_PLATFORM PEON_PLATFORM_LINUX
  89. #endif
  90.  
  91. /* Find the arch type */
  92. #if defined(__x86_64__)
  93. #   define PEON_ARCH_TYPE PEON_ARCHITECTURE_64
  94. #else
  95. #   define PEON_ARCH_TYPE PEON_ARCHITECTURE_32
  96. #endif
  97. // For generating compiler warnings - should work on any compiler
  98. // As a side note, if you start your message with 'Warning: ', the MSVC
  99. // IDE actually does catch a warning :)
  100. #define PEON_QUOTE_INPLACE(x) # x
  101. #define PEON_QUOTE(x) PEON_QUOTE_INPLACE(x)
  102. #define PEON_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
  103.  
  104. //----------------------------------------------------------------------------
  105. // Windows Settings
  106. #if PEON_PLATFORM == PEON_PLATFORM_WIN32
  107.  
  108. // If we're not including this from a client build, specify that the stuff
  109. // should get exported. Otherwise, import it.
  110. #    if defined( __MINGW32__ )
  111.         // Linux compilers don't have symbol import/export directives.
  112. #       define _PeonExport
  113. #       define _PeonPrivate
  114. #   else
  115. #       if defined( PEON_NONCLIENT_BUILD )
  116. #           define _PeonExport __declspec( dllexport )
  117. #       else
  118. #           define _PeonExport __declspec( dllimport )
  119. #       endif
  120. #       define _PeonPrivate
  121. #    endif
  122. // Win32 compilers use _DEBUG for specifying debug builds.
  123. #   ifdef _DEBUG
  124. #       define PEON_DEBUG_MODE 1
  125. #   else
  126. #       define PEON_DEBUG_MODE 0
  127. #   endif
  128.  
  129. #if defined( __MINGW32__ )
  130.     #define EXT_HASH
  131. #else
  132.     #define snprintf _snprintf
  133.     #define vsnprintf _vsnprintf
  134. #endif
  135.  
  136.  
  137. #endif
  138.  
  139.  
  140.  
  141. //----------------------------------------------------------------------------
  142.  
  143. //----------------------------------------------------------------------------
  144. // Linux/Apple Settings
  145. #if PEON_PLATFORM == PEON_PLATFORM_LINUX || PEON_PLATFORM == PEON_PLATFORM_APPLE
  146.  
  147. // Enable GCC 4.0 symbol visibility 
  148. #   if PEON_COMP_VER >= 400
  149. #       define _PeonExport  __attribute__ ((visibility("default")))
  150. #       define _PeonPrivate __attribute__ ((visibility("hidden")))
  151. #   else
  152. #       define _PeonExport
  153. #       define _PeonPrivate
  154. #   endif
  155.  
  156. // A quick define to overcome different names for the same function
  157. #   define stricmp strcasecmp
  158.  
  159. // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
  160. // specifying a debug build.
  161. #   ifdef DEBUG
  162. #       define PEON_DEBUG_MODE 1
  163. #   else
  164. #       define PEON_DEBUG_MODE 0
  165. #   endif
  166.  
  167.  
  168.  
  169. #endif
  170.  
  171.  
  172. //----------------------------------------------------------------------------
  173.  
  174. //----------------------------------------------------------------------------
  175. // Endian Settings
  176. // check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
  177. #ifdef CONFIG_BIG_ENDIAN
  178. #    define PEON_ENDIAN PEON_ENDIAN_BIG
  179. #else
  180. #    define PEON_ENDIAN PEON_ENDIAN_LITTLE
  181. #endif
  182.  
  183. // Integer formats of fixed bit width
  184. typedef unsigned int uint32;
  185. typedef unsigned short uint16;
  186. typedef unsigned char uint8;
  187.  
  188. }
  189.  
  190. #endif
  191.  
  192.  
  193.